

<%@ page import="com.dog.Dog" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'dog.label', default: 'Dog')}" />
        <title><g:message code="default.edit.label" args="[entityName]" /></title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></span>
            <span class="menuButton"><g:link class="list" action="list"><g:message code="default.list.label" args="[entityName]" /></g:link></span>
            <span class="menuButton"><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></span>
        </div>
        <div class="body">
            <h1><g:message code="default.edit.label" args="[entityName]" /></h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${dogInstance}">
            <div class="errors">
                <g:renderErrors bean="${dogInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form method="post" >
                <g:hiddenField name="id" value="${dogInstance?.id}" />
                <g:hiddenField name="version" value="${dogInstance?.version}" />
                <div class="dialog">
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="description"><g:message code="dog.description.label" default="Description" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: dogInstance, field: 'description', 'errors')}">
                                    <g:textField name="description" value="${dogInstance?.description}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="imgs"><g:message code="dog.imgs.label" default="Imgs" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: dogInstance, field: 'imgs', 'errors')}">
                                    <g:select name="imgs" from="${com.dog.Img.list()}" multiple="yes" optionKey="id" size="5" value="${dogInstance?.imgs*.id}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="name"><g:message code="dog.name.label" default="Name" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: dogInstance, field: 'name', 'errors')}">
                                    <g:textField name="name" value="${dogInstance?.name}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="sex"><g:message code="dog.sex.label" default="Sex" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: dogInstance, field: 'sex', 'errors')}">
	                                <g:message code="dog.male" default="male" />
	                                <g:radio name="sex" value="1" checked="true"/>
									<g:message code="dog.female" default="female" />
									<g:radio name="sex" value="2" />
									<g:message code="dog.child" default="child" />
									<g:radio name="sex" value="0" />
                                </td>
                            </tr>
                            
                            <tr class="prop">
	                            <td valign="top" class="name">
	                              <label for="homeFlag"><g:message code="img.homeFlag.label" default="homeFlag" /></label>
	                            </td>
	                            <td valign="top">
									<g:message code="dog.yes" default="yes" />
	                                <g:radio name="homeFlag" value="1"/>
									<g:message code="dog.no" default="no" />
									<g:radio name="homeFlag" value="0" checked="true"/>
	                            </td>
	                        </tr>
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:actionSubmit class="save" action="update" value="${message(code: 'default.button.update.label', default: 'Update')}" /></span>
                    <span class="button"><g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
